package com.sh.activitystudy;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class ActResponseActivity extends AppCompatActivity implements View.OnClickListener {

    private String  rep = "还没有呢";;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_act_response);
        TextView tv_request_two = findViewById(R.id.tv_request_two);
        Bundle extras = getIntent().getExtras();
        String string = extras.getString("req");
        System.out.println("========================");
        System.out.println(string);
        tv_request_two.setText(string);
        TextView tv_response_two = findViewById(R.id.tv_response_two);
        tv_response_two.setText(rep);
        Button btn_response = findViewById(R.id.btn_response);
        btn_response.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putString("respones", rep);
        intent.putExtras(bundle);
        intent.setClass(this, ActRequestActivity.class);
        setResult(Activity.RESULT_OK, intent);
        finish();
    }
}